﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StoneShare.Harvest.AddIn
{
    public partial class frmCredentials : Form
    {
        public frmCredentials()
        {
            InitializeComponent();


        }

        private void frmCredentials_Load(object sender, EventArgs e)
        {
            this.txtURL.Text = Properties.Settings.Default.uri;
            this.txtUserName.Text = Properties.Settings.Default.userName;
            this.txtPassword.Text = Properties.Settings.Default.password;
        }

        private void btnSignIn_Click(object sender, EventArgs e)
        {
            if(this.txtUserName.Text.Length > 0)
                Properties.Settings.Default.userName = this.txtUserName.Text;
            if (this.txtPassword.Text.Length > 0)
                Properties.Settings.Default.password = this.txtPassword.Text;
            if (this.txtURL.Text.Length > 0)
                Properties.Settings.Default.uri = this.txtURL.Text;
            
            Properties.Settings.Default.Save();

            this.Close();

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        
    }
}
